package com.semicolon_dtn;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import android.widget.Toast;

public class MypageActivity extends Activity{
	 Activity mMenuActivity = this;
	 LinearLayout layout;
	 ImageView menuBar;

	 public void onCreate(Bundle savedInstanceState) {
		 super.onCreate(savedInstanceState);
	     setContentView(R.layout.mypage);
		 layout=(LinearLayout)findViewById(R.id.back_layout);
	     layout.setBackgroundResource(R.drawable.back);		//background image

	     Button btn1= new Button(this);
	     Button btn2= new Button(this);
	     Button btn3= new Button(this);
	     
	     Display display =  ((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
	     int scrWidth = display.getWidth();
	     btn1.setBackgroundDrawable(getResources().getDrawable(R.drawable.mypage_b1));
	     btn1.setLayoutParams(new LinearLayout.LayoutParams(scrWidth/4, LinearLayout.LayoutParams.WRAP_CONTENT));
	     btn2.setBackgroundDrawable(getResources().getDrawable(R.drawable.mypage_b2));
	     btn2.setLayoutParams(new LinearLayout.LayoutParams(scrWidth/4, LinearLayout.LayoutParams.WRAP_CONTENT));
	     btn3.setBackgroundDrawable(getResources().getDrawable(R.drawable.mypage_b3));
	     btn3.setLayoutParams(new LinearLayout.LayoutParams(scrWidth/4, LinearLayout.LayoutParams.WRAP_CONTENT));
     
	     LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams ( LinearLayout.LayoutParams.WRAP_CONTENT,  LinearLayout.LayoutParams.WRAP_CONTENT);
     	 layoutParams.setMargins (10, 10, 10, 10);
         btn1.setLayoutParams (layoutParams);
         btn2.setLayoutParams (layoutParams);
         btn3.setLayoutParams (layoutParams);
         layout.setGravity(Gravity.CENTER | Gravity.CENTER_VERTICAL);
         
         btn1.setOnClickListener(new Button.OnClickListener() {
			public void onClick(View v) {				
				Intent game =  new Intent("android.intent.action.REGISTER");
 				startActivity(game);						
			}
         });         
         
         btn2.setOnClickListener(new Button.OnClickListener() {
 			public void onClick(View v) {				
 				Intent game =  new Intent("android.intent.action.CHECKTODAY");
 				startActivity(game);					
 			}
          });         
         
        
         btn3.setOnClickListener(new Button.OnClickListener() {
 			public void onClick(View v) {				
 				Intent game =  new Intent("android.intent.action.ANALYSIS");
 				startActivity(game);							
 			}
          });        
       
         
         layout.addView(btn1);
         layout.addView(btn2);
         layout.addView(btn3);        
	 }	 

	 
}
